package com.rabbiter.association.enums;

public enum AilPayBillTypeEnum {
    TRADE("trade", "交易账单"),
    SIGN_CUSTOMER("signcustomer", "签约账单"),
    CHARGE("charge", "代扣账单"),
    REFUND("refund", "退款账单"),
    TRANSFER("transfer", "转账账单"),
    BATCH_TRANSFER("batch_transfer", "批量转账账单");

    private final String code;
    private final String description;

    AilPayBillTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static AilPayBillTypeEnum fromCode(String code) {
        for (AilPayBillTypeEnum type : AilPayBillTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown bill type code: " + code);
    }
}
